<?php
/* [DoYouHaoBaby!] (C)Dianniu From 2010.
   this($)*/

!defined('DYHB_PATH') && exit;

class TemplateGtkGladeWidgetCompiler_GtkTextView extends TemplateGtkGladeWidgetCompilerBase{

	protected function compileCreateWidget_(TemplateGtkGladeWidget $oObject){
		$sWidgetClass=$oObject->getWidgetClass();
		$sVariableName='$'.TemplateGtkGlade::getWidgetVariableName($oObject);
		$sCompiled="\t\t{$sVariableName}=new {$sWidgetClass}();";
		$sCompiled.="\t\t\$oTextBuffer=new GtkTextBuffer();";
		$sCompiled.="\t\t{$sVariableName}->set_buffer(\$oTextBuffer);";
		if(($sValue=$oObject->getProperty('pixels_above_lines'))!==null){$sCompiled.="\t\t{$sVariableName}->set_pixels_above_lines({$sValue});";}// 行上像素
		if(($sValue=$oObject->getProperty('pixels_below_lines'))!==null){$sCompiled.="\t\t{$sVariableName}->set_pixels_below_lines({$sValue});";}// 行下像素
		if(($sValue=$oObject->getProperty('pixels_inside_wrap'))!==null){$sCompiled.="\t\t{$sVariableName}->set_pixels_inside_wrap({$sValue});";}// 回绕行间距
		if(TemplateGtkGladeObj::nodeTextToValue($oObject->getProperty('editable'))===false){$sCompiled.="\t\t{$sVariableName}->set_editable(false);";}// 可编辑
		if(($sValue=$oObject->getProperty('wrap_mode'))!==null){// 换行模式
			$sValue=str_replace('GTK_','Gtk::',$sValue);
			$sCompiled.="\t\t{$sVariableName}->set_wrap_mode({$sValue});";
		}
		if(($sValue=$oObject->getProperty('justification'))!==null){// 对齐
			$sValue=str_replace('GTK_','Gtk::',$sValue);
			$sCompiled.="\t\t{$sVariableName}->set_justification({$sValue});";
		}
		if(($sValue=$oObject->getProperty('left_margin'))!==null){$sCompiled.="\t\t{$sVariableName}->set_left_margin({$sValue});";}// 左边距
		if(($sValue=$oObject->getProperty('right_margin'))!==null){$sCompiled.="\t\t{$sVariableName}->set_right_margin({$sValue});";}// 右边距
		if(($sValue=$oObject->getProperty('indent'))!==null){$sCompiled.="\t\t{$sVariableName}->set_indent({$sValue});";}// 缩进
		if(TemplateGtkGladeObj::nodeTextToValue($oObject->getProperty('cursor_visible'))===false){$sCompiled.="\t\t{$sVariableName}->set_cursor_visible(false);";}// 光标可见
		if(TemplateGtkGladeObj::nodeTextToValue($oObject->getProperty('overwrite'))){$sCompiled.="\t\t{$sVariableName}->set_overwrite(true);";}// 覆盖模式
		if(TemplateGtkGladeObj::nodeTextToValue($oObject->getProperty('accepts_tab'))===false){$sCompiled.="\t\t{$sVariableName}->set_accepts_tab(false);";}// 接受跳格
		if($sText=$oObject->getProperty('text')){$sCompiled.="\t\t\$oTextBuffer->set_text(\"{$sText}\");";}// 预设文本
		return $sCompiled;
	}

	protected function compileChildWidgetPacking_(TemplateGtkGladeWidget $oParentWidget,TemplateGtkGladeWidget $oChildWidget,TemplateGtkGladeWidgetPacking $oPacking){ }

	static public function regToProcessorManager(ITemplateObjProcessorManager $oManager){
		$oManager->regProcessor(str_replace('TemplateGtkGladeWidgetCompiler_','',__CLASS__),__CLASS__);
	}

}
